//
//  MyInfoTableViewCell.m
//  Wechat
//
//  Created by FONERY on 2019/9/9.
//  Copyright © 2019 Zhangfan. All rights reserved.
//

#import "MyInfoTableViewCell.h"
#import "UIView+ZLConstraint.h"

@interface MyInfoTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *detailLab;
@property (weak, nonatomic) IBOutlet UIImageView *iconImv;

@end

@implementation MyInfoTableViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    MyInfoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyInfoTableViewCellIdentifier"];
    if (cell == nil) {
        cell = [[[UINib nibWithNibName:@"MyInfoTableViewCell" bundle:nil] instantiateWithOwner:nil options:nil] firstObject];
    }
    return cell;
}

+ (CGFloat)cellHeight {
    return 69;
}

+ (CGFloat)cell2Height {
    return 50;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setMyInfoModel:(MyInfoModel *)myInfoModel {
    _myInfoModel = myInfoModel;
    
    self.titleLab.text = myInfoModel.title;
    self.iconImv.hidden = YES;
    self.detailLab.hidden = YES;
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    switch (myInfoModel.type) {
        case MyInfoTableViewCellTypeNormal:
            self.accessoryType = UITableViewCellAccessoryNone;
            self.detailLab.text = myInfoModel.detail;
            self.detailLab.hidden = NO;
            break;
        case MyInfoTableViewCellTypeDetail:
            self.detailLab.text = myInfoModel.detail;
            self.detailLab.hidden = NO;
            break;
        case MyInfoTableViewCellTypeHead:
            self.iconImv.hidden = NO;
            self.iconImv.image = [UIImage imageNamed:myInfoModel.image];
            break;
        case MyInfoTableViewCellTypeAccessory:
            
            break;
        default:
            break;
    }
}

@end
